@extends('plugin.layout.baseDoing')
@section('add_css')
    <link rel="stylesheet" href="{{ ___('/admin/js/jquery.tagsinput.css') }}">
    <link rel="stylesheet" href="{{ ___('/admin/js/select2/select2.css') }}">
@endsection
@section('content')
    <div class="layui-card">

        <div class="layui-card-body">
            <div class="layui-form layui-form-kongqi" lay-filter="">
                {{ csrf_field() }}
                <input type="hidden" name="category_id" value="{{ $category_id }}">

                <input type="hidden" name="admin_id" value="{{ admin('id') }}">

                <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                    <ul class="layui-tab-title">
                        <li class="layui-this">基本信息</li>
                        <li>图片设置</li>
                        <li>SEO设置</li>
                        <li>系统设置</li>


                    </ul>
                    <div class="layui-tab-content">
                        <div class="layui-tab-item layui-show">

                            @if(count($server)>0)
                                <div class="layui-form-item">
                                    <label class="layui-form-label">配置分类</label>
                                    <div class="layui-input-block">
                                        <select name="config_level_id" id=""  lay-verify="rq" >
                                            <option value="">请选择</option>
                                            @foreach ($server as $k=>$v)
                                                <option value="{{ $v['id'] }}" {{ $v['depth']==0?'disabled':'' }} >{{ str_repeat("-", $v['depth'] * 4) }}{{ $v['name'] }}</option>
                                            @endforeach
                                        </select>

                                    </div>
                                </div>
                            @endif
                            @include('plugin.tpl.form.text',[
                                'data'=>[
                                    'name'=>'name',
                                    'title'=>'名称',
                                    'tips'=>'',
                                    'value'=>'',
                                    'rq'=>'rq'
                            ]])
                             @include('plugin.tpl.form.text',[
                               'data'=>[
                                   'name'=>'money',
                                   'title'=>'价格',
                                   'tips'=>'',
                                   'value'=>'',
                                   'mark'=>'单位(RMB)',
                                   'rq'=>'rq'
                           ]])
                            @include('plugin.tpl.form.text',[
                               'data'=>[
                                   'name'=>'bandwidth',
                                   'title'=>'带宽',
                                   'tips'=>'',
                                   'mark'=>'单位(M)',
                                   'value'=>'',
                                   'rq'=>'1'
                               ]
                           ])
                            @include('plugin.tpl.form.text',[
                               'data'=>[
                                   'name'=>'cpu',
                                   'title'=>'cpu',
                                   'tips'=>'',
                                    'mark'=>'单位(核)',
                                   'value'=>'',
                                   'rq'=>'rq'
                           ]])
                            @include('plugin.tpl.form.text',[
                               'data'=>[
                                   'name'=>'memory',
                                   'title'=>'内存',
                                   'tips'=>'比如：2，则输出2G',
                                   'mark'=>'单位(G)',
                                   'value'=>'',
                                   'rq'=>'rq'
                           ]])
                            @include('plugin.tpl.form.text',[
                                'data'=>[
                                    'name'=>'disk',
                                    'title'=>'硬盘',
                                    'tips'=>'比如：2，则输出2G',
                                    'mark'=>'单位(G)',
                                    'value'=>'',
                                    'rq'=>'rq'
                            ]])
                            @include('plugin.tpl.form.text',[
                                'data'=>[
                                    'name'=>'disk_type',
                                    'title'=>'硬盘类型',
                                    'tips'=>'',
                                    'mark'=>'例如SSD，机械，云盘',
                                    'value'=>'',
                                    'rq'=>''
                            ]])



                            @include('plugin.tpl.form.textarea',[
                                'data'=>[
                                    'name'=>'feature',
                                    'title'=>'特色',
                                    'tips'=>'比如：专注于速度',
                                    'value'=>'',
                                    'rq'=>''
                                ]
                            ])
                            @include('plugin.tpl.form.textarea',[
                               'data'=>[
                                   'name'=>'defense_feature',
                                   'title'=>'防御特点',
                                   'tips'=>'比如：ddos攻击秒解(不死防御)',
                                   'value'=>'',
                                   'rq'=>''
                           ]])
                            @include('plugin.tpl.form.text',[
                              'data'=>[
                                  'name'=>'area',
                                  'title'=>'地区',
                                  'tips'=>'',
                                  'value'=>'',
                                  'rq'=>''
                          ]])
                            @include('plugin.tpl.form.textarea',[
                             'data'=>[
                                 'name'=>'intro',
                                 'title'=>'介绍',
                                 'tips'=>'',
                                 'value'=>'',
                                 'rq'=>''
                            ]])



                            @include('plugin.tpl.form.radio',[
                             'data'=>[
                             'name'=>'is_hot',
                             'title'=>'是否热门',
                             'mark'=>'',
                             'tips'=>'',
                             'rq'=>'rq',
                             'on_id'=>0,
                             'value'=>'',
                             'list'=>[
                                 'type'=>'',
                                 'data'=>[
                                           [
                                           'id'=>'1',
                                           'name'=>'否'
                                           ],
                                             [
                                           'id'=>'0',
                                           'name'=>'是'
                                           ]
                                     ]
                             ]
                         ]])

                          @include('plugin.tpl.form.radio',[
                             'data'=>[
                             'name'=>'is_checked',
                             'title'=>'是否禁用',
                             'mark'=>'',
                             'tips'=>'',
                             'rq'=>'rq',
                             'on_id'=>1,
                             'value'=>'',
                             'list'=>[
                                 'type'=>'',
                                 'data'=>[
                                           [
                                           'id'=>'1',
                                           'name'=>'否'
                                           ],
                                             [
                                           'id'=>'0',
                                           'name'=>'是'
                                           ]
                                     ]
                             ]
                         ]])

                            @include('plugin.tpl.form.text',[
                                'data'=>[
                                    'name'=>'sort',
                                    'title'=>'排序',
                                    'tips'=>'',
                                    'value'=>'0',
                                    'rq'=>'rq'
                                ]
                            ])
                        </div>
                        <div class="layui-tab-item ">
                            @include('plugin.tpl.form.thumbPlace',[
                               'data'=>[
                                          'name'=>'thumb',
                                          'value'=>'',
                                          'show'=>0,
                                          'title'=>'缩略图',
                                          'tips'=>'',
                                          'rq'=>'',
                                          'place'=>1,
                                          'obj'=>'thumbUpload'
                              ]])

                        </div>
                        <div class="layui-tab-item ">
                            @include('plugin.tpl.form.seo')
                        </div>
                        <div class="layui-tab-item ">
                            @include('plugin.'.$controller_base_lower.'.system')
                        </div>

                    </div>
                </div>
                @include('admin.tpl.form.submit')
            </div>
        </div>
    </div>

@endsection
@section('foot_js')
    <script>
        layui.use(['index', 'form', 'uploader'], function () {
            var form = layui.form;


            form.on('checkbox', function (data) {
                var check = data.elem.checked;//是否选中
                var checkId = data.elem.id;//当前操作的选项框
                if (check) {
                    //选中
                    var ids = checkId.split("-");
                    if (ids.length == 3) {
                        //第三极菜单
                        //第三极菜单选中,则他的上级选中
                        $("#" + (ids[0] + '-' + ids[1])).prop("checked", true);
                        $("#" + (ids[0])).prop("checked", true);
                    } else if (ids.length == 2) {
                        //第二季菜单
                        $("#" + (ids[0])).prop("checked", true);
                        $("input[id*=" + ids[0] + '-' + ids[1] + "]").each(function (i, ele) {
                            $(ele).prop("checked", true);
                        });
                    } else {
                        //第一季菜单不需要做处理
                        $("input[id*=" + ids[0] + "-]").each(function (i, ele) {
                            $(ele).prop("checked", true);
                        });
                    }
                } else {
                    //取消选中
                    var ids = checkId.split("-");
                    if (ids.length == 2) {
                        //第二极菜单
                        $("input[id*=" + ids[0] + '-' + ids[1] + "]").each(function (i, ele) {
                            $(ele).prop("checked", false);
                        });
                    } else if (ids.length == 1) {
                        $("input[id*=" + ids[0] + "-]").each(function (i, ele) {
                            $(ele).prop("checked", false);
                        });
                    }
                }
                form.render();
            });

        })
    </script>

@endsection
